import $ from 'jquery'

const URLS = {
    USER_LIST:"http://127.0.0.1:3000/user/list",
    CORS_LIST:"http://127.0.0.1:3000/cors/list"
}

const request = function(options={}){
    return new Promise(function(resolve,reject){

        let defaultOptions = {
            success:resolve,
            error:reject
        }

        let newOptions = Object.assign(defaultOptions,options)

        $.ajax(newOptions)
    })
}

const loadUserList = function() {
    return request({
        url:URLS.USER_LIST,
        method:"GET"
    })
}

export default {
    loadUserList
}